<template>

    <view class="cu-modal" :class="showDialog ? 'show': '' ">
        <view class="cu-dialog text-grey bg-white padding-bottom" style="width:80%;">
            <view class="padding">
                <view><img :src="logo" class="round" style="width:100rpx;height:100rpx;" mode="aspectFit"/></view>
                <view class="margin-top text-lg">
                    <view class="text-grey">小程序需要你的允许才能正常使用</view>
                    <view class="text-grey">请点击'去设置'并勾选地理位置，然后确定即可正常使用</view>
                </view>
            </view>
            <view class="response padding-lg justify-center" style="display: grid;grid-template-columns: 40% 40%;grid-gap: 40rpx;">
                <button class="cu-btn text-sm bg-gray radius" @tap="hide">取消</button>
                <button class="cu-btn text-sm bg-green radius" @opensetting="opensetting" open-type="openSetting">去设置</button>
            </view>
        </view>
    </view>
</template>
<script>
    export default {
        props:{
        },
        data(){
           return  {
               logo:this.$tools.j('logo.png'),
               showDialog:false
            }
        },
        methods:{
            show(){
                this.showDialog = true
            },
            hide(){
                this.showDialog = false
            },
            //打开权限设置
            opensetting(e){
                console.log('bindopensetting')
                if (!e.detail.authSetting['scope.userLocation']){
                    console.log('用户继续拒绝了')
                    this.$cache.put('locationTwiceRefuse',1,7*24*3600) //保存7天

                }
                this.showDialog = false
                this.$emit('authorizeLocationOk')

            },
        },
        created() {
        }
    }
</script>

<style scoped>

</style>
